<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import="com.tjsinfo.tjsoa.system.vo.User"%>
<%@page import="com.tjsinfo.tjsoa.system.vo.TSystemUser"%>
<%@page import="com.tjsinfo.tjsoa.addresslist.vo.AddressListAndFilePending"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>粮油集团办公自动化协作平台</title>
    <meta http-equiv="x-ua-compatible" content="ie=7" />
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<link href="<%=basePath%>style/txlz7.css" rel="stylesheet" type="text/css" id="txlz7"/>
	<script type="text/javascript" src="<%=basePath%>js/ie.js"></script>
	<script type="text/javascript" src="<%=basePath%>js/png.js"></script>
	<style type="text/css">
			td {
				font:12px/170% "宋体", "新宋体", "黑体"; color:#000
			}
			th {
				font:12px/170% "宋体", "新宋体", "黑体"; color:#000
			}
	</style>
	<style>
		 #divgroup {width:100%;height:100%;overflow:hidden;}
         .trBgColor { background-color:#A4D7E8; cursor: hand;}
         .trGroupColor { background-color:#C3EBF9; cursor: hand;}
         .trHiddivColor { background-color:#c3ebf9; cursor: hand;}
         
		.senddown {
			height: 27.1%;
			width: 98%;
			margin-top:0px;
			border:1px #9DB0BC solid;
			background:#fff;
			float:left;
			margin-left:3px;
		}
		.senddown1 {
			height: 77.4%;
			width: 98%;
			margin-top:6px;
			border:1px #9DB0BC solid;
			background:#fff;
			float:left;
			margin-left:3px;
		}
   </style>
                
	<script type='text/javascript' src='<%=basePath%>dwr/interface/AddressListGroupBo.js'></script>
	<script type='text/javascript' src='<%=basePath%>dwr/interface/AddressListUserBo.js'></script>
	<script type='text/javascript' src='<%=basePath%>dwr/interface/AddressListUserPageBo.js'></script>
	<script type='text/javascript' src="<%=basePath%>dwr/engine.js"></script>
	<script type='text/javascript' src="<%=basePath%>dwr/util.js"></script>
	
	<link href="<%=basePath %>ajaxFramework/ext-2.1/resources/css/ext-all.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="<%=basePath %>ajaxFramework/ext-2.1/adapter/ext/ext-base.js"></script>
    <script type="text/javascript" src="<%=basePath %>ajaxFramework/ext-2.1/ext-all-debug.js"></script>
    <script type="text/javascript" src="<%=basePath %>ajaxFramework/ext-2.1/source/locale/ext-lang-zh_CN.js"></script>
    <script type="text/javascript" src="<%=basePath %>ajaxFramework/jQuery/jquery.js"></script>
	<script type="text/javascript" src="<%=basePath %>js/common/system/selectusertreecheck.js"></script>
	<%
		List list = (List)request.getAttribute("list");
		List weilist = (List)request.getAttribute("weilist");
		String yuanusers = "";
		String yuanuserName = "";
		String returnString = (String)request.getAttribute("returnString");
		if(returnString == null)returnString="";
	 %>
	<script type="text/javascript">
		var copyid = '';
		var copygroup = '';
		window.onload = function(){
			initselectusertreecheck();
			var tb = new Ext.Toolbar(
				{
					height:25
				}
			);
		
		    tb.render('menu');
			tb.add(
		    {
		            text:'确定',
		            iconCls: 'daohang',
		        	handler: function(){
		        		submitform();
					}
		    },
		    {
		            text:'返回',
		            iconCls: 'daohang',
		        	handler: function(){
		        		window.location.href = '<%=basePath%>tjsinfo/tjsoa/addresslist/loginAddressList.do';
					}
		    }
		    );
			tb.addFill();
		    tb.addText('<img id="windowResize" src="<%=basePath%>images/m_icon05.gif;"><a style="font-weight:bold; color:black;line-height: 22px;">同步个人信息</a>&nbsp;&nbsp;&nbsp;');
		}
	</script>
<script type="text/javascript">
	function move2()
{
	var checkbox2 = document.getElementsByName('checkbox2');
	var list2 = document.getElementById('list2');
	var length  = checkbox2.length;
	for(var a = 0; a<checkbox2.length; a++)
	{
			var check1 = checkbox2[a];
			if(check1.checked == true)
			{
				var li = document.getElementById(check1.value);
				list2.removeChild(li);
				a--;
			}		
	}
}
</script>
  </head>
  <body>
<div id="right" style="height: 100%;">
		<div id="menu" style="padding-top:4px;"></div>
		<form action="<%=basePath %>tjsinfo/tjsoa/addresslist/synchronization.do" name="form1" method="post">
      <div class="contact_content" style="height: 92%;border-top:0px;">
         	  	    <table width="65%" border="0" align="center" cellpadding="0" cellspacing="0" style="margin-top:10px">
                      <tr>
                        <td>
                        	<table width="100%" border="0" cellspacing="0" cellpadding="0">
                              <tr>
                                <td width="50%"  valign="top">
                                	<table width="100%" border="0" cellspacing="0" cellpadding="0" >
                                      <tr>
                                        <td><img src="<%=basePath%>images/wjm01.gif" /></td>
                                      </tr>
                                      <tr>
                                        <td class="wjsd_wjm02">
                                			<div style="height: 250px;overflow-y: scroll;">
                                        	<table width="90%" border="0" style="margin-left: 6px;" cellspacing="0" cellpadding="0" align="center" class="wjsd_ttaa">
                                              <tr bgcolor="#F1F2F2">
                                                <td align="center">已同步我的用户</td>
                                              </tr>
                                              <%
                                              	int i =  1;
                                              	for (Iterator iterator = list.iterator(); iterator
													.hasNext();) {
													TSystemUser user = (TSystemUser) iterator.next();
													yuanusers +=  user.getUserId().toString()+",";
													if(i%2 == 0){
												%>
												<tr bgcolor="#F1F2F2">
                                                <td align="center"><%=user.getUserName() %></td>
                                              </tr>
												<%	
													}else{
												%>
												<tr>
                                                <td align="center"><%=user.getUserName() %></td>
                                              </tr>
												<%	
													}
													i++;
												}
                                               %>
                                            </table>
                                            </div>
                                        </td>
                                      </tr>
                                      <tr>
                                        <td><img src="<%=basePath%>images/wjm03.gif" /></td>
                                      </tr>
                                    </table>
                                </td>
                                <td width="50%">
                                	<table width="100%" border="0" cellspacing="0" cellpadding="0">
                                      <tr>
                                        <td><img src="<%=basePath%>images/wjm01.gif" /></td>
                                      </tr>
                                      <tr>
                                        <td class="wjsd_wjm02">
                                        <div style="height: 250px;overflow-y: scroll;">
                                        	<table width="92%" border="0" style="margin-left: 6px;" cellspacing="0" cellpadding="0" align="center" class="wjsd_ttaa">
                                              <tr bgcolor="#F1F2F2">
                                                <td align="center">待确认用户</td>
                                              </tr>
                                              <%
                                              	int j = 1;
                                              	for (Iterator iterator = weilist.iterator(); iterator
													.hasNext();) {
													TSystemUser user = (TSystemUser) iterator.next();
													if(j%2 == 0){
											 %>
											<tr bgcolor="#F1F2F2">
                                                <td align="center"><%=user.getUserName() %></td>
                                              </tr>
											 <%	
													}else{
												%>
												<tr>
                                                <td align="center"><%=user.getUserName() %></td>
                                              </tr>
												<%
													}
													j++;
                                              	}
                                               %>
                                            </table>
                                            </div>
                                        </td>
                                      </tr>
                                      <tr>
                                        <td><img src="<%=basePath%>images/wjm03.gif" /></td>
                                      </tr>
                                    </table>
                                </td>
                              </tr>
                              <tr>
                                <td>&nbsp;</td>
                              </tr>
                            </table>
                        </td>
                      </tr>
                      <tr>
                      	<td background="<%=basePath%>images/line02.gif" height="5px"></td>
                      </tr>
                      <tr>
                      	<td>
                            <table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-top:10px; margin-left:5px">
                            	<tr>
                            		<td colspan="2">请选择允许同步自己的系统用户:</td>
                            	</tr>
                              <tr>
                              <td width="180px">
			               		<input name="uuuuuuu" id="uuuuuuu" size="100" value="<%=yuanuserName %>">
			               		</td>
			               		<td align="left">
			               		<input type="button" value="选择" onclick="selectusertreecheckwinshow('sendusers','uuuuuuu','node2')"/>
               					</td>
                              </tr>
                            </table>
                        </td>
                      </tr>
               		</table>
            </div>
	<input type="hidden" id="copyid" name="copyid"/>
	<input type="hidden" id="sendusers" name="sendusers"/>
	<input type="hidden" id="yuanusers" name="yuanusers"/>
	<input type="hidden" name="node2" id="node2"/>
    <input id="basePath" value="<%=basePath%>" type="hidden"/>
      </form>
</div>



<script type="text/javascript">
	function submitform(){
			var checkbox2 = document.getElementsByName('checkbox2');
			var length  = checkbox2.length;
			
			var sendusers = document.getElementById('sendusers').value;
			for(var a = 0; a<length; a++)
			{
				var check1 = checkbox2[a].value;
				sendusers += check1+",";	
			}
			var str = '<%=yuanusers %>';
			
			if( sendusers == ''){
				Ext.MessageBox.alert('提示框','<nobr>请选择要进行同步的用户</nobr>');return;
			}
			document.getElementById('sendusers').value = sendusers;
			document.getElementById('yuanusers').value = '<%=yuanusers %>';
			document.form1.submit();
		}
</script>
<script type="text/javascript">
	<%
		if(returnString!=null && !"".equals(returnString)){
	%>
	Ext.MessageBox.alert('提示框','<nobr>申请成功</nobr>');
	<%
		}
	%>
</script>
  </body>
</html>
